package oauth2

import (
	"data/config"
	"data/view/common"
	"fmt"
	"public/message"
	"public/myhttp"
	"public/mysign"
	"public/tools"
)

/*
自动注册,修改密码
*/
func OnDoaction(req Req_doaction) bool {
	req.Signature = ""
	req.Signature = mysign.OnGetSign(req.Appid, req)
	fmt.Println(config.GetRegistUrl("/doaction"))
	var mess message.MessageBody
	myhttp.SendPost(req, &mess, config.GetRegistUrl("/doaction"))
	return mess.State
}

//修改密码
func OnChangePwd(username, passworld string) bool {
	var req Req_doaction
	req.Appid = config.GetSignKey()
	req.Bundleid = common.RECRUIT_TOPIC
	req.Flag = 2
	req.UserName = username
	req.Password = tools.Md5Encoder(passworld)
	req.Signature = mysign.OnGetSign(req.Appid, req)
	var mess message.MessageBody
	myhttp.SendPost(req, &mess, config.GetRegistUrl("/doaction"))
	return mess.State
}
